package com.yjy.exception;

public class MainTest {
    public static void main(String[] args) {
        // 成功
        System.out.println(PaymentTradeMsgCode.SUCCESS.getCode() + " " + PaymentTradeMsgCode.SUCCESS.getMsg());

        // user服务-token为空
        System.out.println(UserMsgCode.TOKEN_EMPTY.getCode() + " " + UserMsgCode.TOKEN_EMPTY.getMsg());

        // trade服务-系统错误
        System.out.println(PaymentTradeMsgCode.SYSTEM_ERROR.getCode() + " " + PaymentTradeMsgCode.SYSTEM_ERROR.getMsg());

        // 服务请求错误
        System.out.println(PaymentTradeMsgCode.SERVICE_REQ_ERROR.getCode() + " " + PaymentTradeMsgCode.SERVICE_REQ_ERROR.getMsg());

        // 交易确认中
        System.out.println(PaymentTradeMsgCode.TRADE_RESULT_CONFIRMING.getCode() + " " + PaymentTradeMsgCode.TRADE_RESULT_CONFIRMING.getMsg());

        try {
            throw new TradeException(PaymentTradeMsgCode.TRADE_RESULT_FAILURE);
        } catch (TradeException e) {
            System.out.println(e.getCode());
            System.out.println(e.getMsg());
        }
    }
}
